/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/ccjzxyxt">ccjzxyxt</a> All rights reserved.
 */
package cn.net.dckj.modules.biz.service;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.net.dckj.common.persistence.Page;
import cn.net.dckj.common.service.CrudService;
import cn.net.dckj.modules.biz.entity.BizSchoolCalendar;
import cn.net.dckj.modules.biz.dao.BizSchoolCalendarDao;

/**
 * 校历信息Service
 * @author xzy
 * @version 2019-04-15
 */
@Service
@Transactional(readOnly = true)
public class BizSchoolCalendarService extends CrudService<BizSchoolCalendarDao, BizSchoolCalendar> {

	public BizSchoolCalendar get(String id) {
		return super.get(id);
	}
	
	public List<BizSchoolCalendar> findList(BizSchoolCalendar bizSchoolCalendar) {
		return super.findList(bizSchoolCalendar);
	}
	
	public Page<BizSchoolCalendar> findPage(Page<BizSchoolCalendar> page, BizSchoolCalendar bizSchoolCalendar) {
		return super.findPage(page, bizSchoolCalendar);
	}
	
	@Transactional(readOnly = false)
	public void save(BizSchoolCalendar bizSchoolCalendar) {
		super.save(bizSchoolCalendar);
	}
	
	@Transactional(readOnly = false)
	public void delete(BizSchoolCalendar bizSchoolCalendar) {
		super.delete(bizSchoolCalendar);
	}

	/**
	 * 根据学年确定校历
	 * @param schoolYear
	 * @return
	 */
	public BizSchoolCalendar getSchoolCalendar(String schoolYear) {
		BizSchoolCalendar result = null;
		// 确定学年和学期，查找校历
		BizSchoolCalendar bizSchoolCalendar = new BizSchoolCalendar();
		bizSchoolCalendar.setSchoolYear(schoolYear);
		List<BizSchoolCalendar> list = this.findList(bizSchoolCalendar);
		if (list != null && list.size() > 0) {
			result = list.get(0);
		}
		return result;
	}
}